package com.loong.user.verifiy;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.loong.common.redis.RedisTools;
import com.loong.common.redis.operations.LoongRedisOperations;
import com.loong.common.utils.DESEncrypt;
import com.loong.global.dto.UserDTO;
import com.loong.user.BaseTest;
import org.junit.Test;
import org.springframework.data.redis.core.CommonHashOperations;

import java.math.BigDecimal;
import java.util.*;

public class Token extends BaseTest {

    @Test
    public void test() throws Exception {
        String s = UUID.randomUUID().toString();
        String token = DESEncrypt.encrypt("USER_CATCH_55"+s,"loong-forehead");
        System.out.println(token);
    }
    @Test
    public void testRedis(){
        UserDTO userDTO = new UserDTO();
        userDTO.setAreaCode("8");
        userDTO.setAvatar("dhjaskdh");
        List<UserDTO> userDTOS = new ArrayList<>();
        userDTOS.add(userDTO);
        RedisTools.hashOperations().put("xd-test","a",userDTOS);
        userDTO.setCountry("zh");
        userDTOS.add(userDTO);
        RedisTools.hashOperations().put("xd-test","b",userDTOS);
        Map<String, List<UserDTO>> entries = RedisTools.hashOperations().entriesList("xd-test", UserDTO.class);
        System.out.println(entries.get("a"));

    }
}
